# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=coin-or-data-sample
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.2.13
pkgrel=1
pkgdesc="COIN-OR Sample data (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://github.com/coin-or-tools/Data-Sample'
msys2_references=(
  'archlinux: coin-or-data-sample'
)
license=('spdx:EPL-2.0')
groups=("${MINGW_PACKAGE_PREFIX}-coin-or")
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-coin-or-buildtools")
source=("https://github.com/coin-or-tools/Data-Sample/archive/releases/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('cb4c3713b2a2510d0b6387c24a68c88ba5eff27e2c392429653b1bdef50f06c9')

prepare() {
  cp -r ${MINGW_PREFIX}/share/coin-or-buildtools/BuildTools Data-Sample-releases-${pkgver}

  cd Data-Sample-releases-${pkgver}

  ACLOCAL="aclocal -I${srcdir}/Data-Sample-releases-${pkgver}/BuildTools" \
  autoreconf -fiv
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  ../"Data-Sample-releases-${pkgver}"/configure \
    --prefix="${MINGW_PREFIX}"

  make
}

check() {
  cd "${srcdir}/build-${MSYSTEM}"

  make check
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make install DESTDIR="${pkgdir}"
}
